import { HRDLevels } from "./LevelsConfig";


export default class DataManager {
    public static m_instante: DataManager = null;

    public static getIns() {
        if (!DataManager.m_instante) {
            DataManager.m_instante = new DataManager();
        }
        return DataManager.m_instante;
    }

    private constructor() {

    }

    private m_currentLevel: string = null;


    public setCurrentLevel(key: string) {
        this.m_currentLevel = key;
    }

    public getCurrentLevel(): string {
        return this.m_currentLevel;
    }

    public getFrontLevel(): string {
        let frontLevel = String(Number(this.m_currentLevel) - 1);
        if (HRDLevels && HRDLevels.hasOwnProperty(frontLevel)) {
            return frontLevel;
        }
        return '';
    }

    public getNextLevel(): string {
        let nextLevel = String(Number(this.m_currentLevel) + 1);
        if (HRDLevels && HRDLevels.hasOwnProperty(nextLevel)) {
            return nextLevel;
        }
        return '';
    }

}
